package com.example.jetpack_databinding.main4

import android.util.Log
import androidx.databinding.BaseObservable
import androidx.databinding.Bindable
import com.example.jetpack_databinding.BR

class UserViewmodel:BaseObservable() {
    var user: User = User("Jack")
    @Bindable
    public fun getUserName(): String {
        return user.userName
    }
    public fun setUserName(userName:String?) {
        if (userName!=null&& userName != user.userName){
            user.userName=userName
            Log.d("MyEditText", "set username:${userName}")
            notifyPropertyChanged(BR.userName)
        }
    }
}